<%@ page language="java" contentType="text/html;charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<script src="<c:url value='/js/dtree.js'/>"></script>
<script type="text/javascript">
	function selectAAdl(url) {
		var projectId = "${project.id}";
		var submitForm = document.createElement("form");
		document.body.appendChild(submitForm);
		submitForm.method = "POST";
		var newElement = document.createElement("input");
		newElement.setAttribute("name", "projectId");
		newElement.setAttribute("type", "hidden");
		newElement.setAttribute("value", projectId);
		submitForm.appendChild(newElement);
		submitForm.action = url;
		submitForm.submit();
	}
</script>

<c:choose>
	<c:when test="${!empty project }">
		<div class="page-header">
			<h3 style="margin-top: auto">
				<c:out value="${project.name}"></c:out>
			</h3>
		</div>

		<div class="">
			<table class="table table-hover">
				<tr>
					<td>
						<h4>设计系统架构</h4>
					</td>
					<td><c:choose>
							<c:when test="${empty project.model }">
								<Button class="btn "
									onclick="selectAAdl('<%=request.getContextPath()%>/aadl/template/select')">编辑系统架构</Button>
							</c:when>
							<c:otherwise>
								<Button class="btn"
									onclick="window.location.href='<%=request.getContextPath()%>/${project.model.getUri().replace(':', '/') }';">
									<i class="icon-search"></i> 查看系统架构
								</Button>
								<Button class="btn"
									onclick="window.location.href='<%=request.getContextPath()%>/${project.model.getUri().replace(':', '/') }/update?projectId=${project.id}';">
									<i class="icon-pencil"></i> 更新系统架构
								</Button>
								<Button class="btn"
									onclick="window.location.href='<%=request.getContextPath()%>/${project.model.getUri().replace(':', '/') }/aadl';">
									<i class="icon-search"></i> 查看AADL文档
								</Button>
								<Button class="btn"
									onclick="window.location.href='<%=request.getContextPath()%>/${project.model.getUri().replace(':', '/') }/aadl/download';">
									<i class="icon-download-alt"></i> 下载AADL文档
								</Button>
							</c:otherwise>
						</c:choose></td>
				</tr>
				<tr>
					<td><h4>导出参与者与子系统</h4></td>
					<td>
						<Button class="btn"
							onclick="window.location.href='<%=request.getContextPath()%>/rhapsody/${project.id}/actor';">
							<i class="icon-download-alt"></i> 下载Actor文件
						</Button>
					</td>
				</tr>
				<tr>
					<td><h4>导入系统功能模型</h4></td>
					<td>
						<form class="form-horizontal"
							action="<%=request.getContextPath()%>/rhapsody/${project.id}/upload"
							method="POST" enctype="multipart/form-data"
							onsubmit="return valid()">

							<div class="control-group" id="rhapsody_file_div">
								<label class="control-label">源文件</label>
								<div class="controls">
									<!-- input type="hidden" value="${project.id}" name="projectId" / -->
									<input type="file" class="file-inputs" title="选择rhapsody文件"
										name="rhapsody_file">
									<button type="submit" class="btn " id="submit">
										<i class="icon-ok"></i> 提交
									</button>
									<span class="help-inline" id="rhapsody_file_help"></span>
								</div>
							</div>
						</form>
						<div class="form-horizontal">
							<div class="control-group">
								<label class="control-label">已有文件</label>
								<div class="controls">
									<c:choose>
										<c:when test="${!empty project.rhapsodyFile }">
											<code>${project.rhapsodyFile}</code>
										</c:when>
										<c:otherwise>
											<c:out value="还没有文件"></c:out>
										</c:otherwise>
									</c:choose>
									<a class="btn " name=""
										href="<%=request.getContextPath()%>/rhapsody/${project.id}/mapDesignPattern">映射设计模式</a>
								</div>
							</div>
						</div>
					</td>
				</tr>
				<tr>
					<td><h4>设计模式组件</h4></td>
					<td><a class="btn " name=""
						href="<%=request.getContextPath()%>/entityZone/${project.id}/list"><i
							class="icon-pencil"></i> 编辑设计模式</a></td>
				</tr>
				<tr>
					<td><h4>代码生成</h4></td>
					<td>
						<button class="btn "
							onclick="window.location.href='<%=request.getContextPath()%>/project/${project.id}/generateCode'">
							<i class="icon-download-alt"></i> 真机代码
						</button>
						<button class="btn "
                            onclick="window.location.href='<%=request.getContextPath()%>/project/${project.id}/generateCode'">
                            <i class="icon-download-alt"></i> 模拟代码
                        </button>
					</td>
				</tr>
			</table>

		</div>
	</c:when>
	<c:otherwise>
		<div class="page-header">
		    <ul class="breadcrumb">
                <li>
                    <h3 style="margin-top: auto"><c:out value="项目信息"></c:out></h3>
                </li>
            </ul>

		</div>
		
	</c:otherwise>
</c:choose>

<!-- Le javascript
    ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="<c:url value='/js/project.js'/>"></script>


